//
//  ThreeCell.m
//  FiveWork
//
//  Created by lanou3g on 15/11/19.
//  Copyright © 2015年 Project. All rights reserved.
//

#import "ThreeCell.h"
#import "NewModel.h"
#import "UIImageView+WebCache.h"

@interface ThreeCell ()
@property(nonatomic,strong)UILabel *titlelabel;
@property(nonatomic,strong)UIImageView *imageView1;
@property(nonatomic,strong)UIImageView *imageView2;
@property(nonatomic,strong)UIImageView *imageView3;


@end
@implementation ThreeCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self =[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self ) {
        [self setupSubViews];
    }
    return self;
}

-(void)setupSubViews{
    
    CGFloat tiX =5;
    CGFloat tiY =5;
    CGFloat tiW =self.frame.size.width;
    CGFloat tiH =30;
    self.titlelabel =[[UILabel alloc] initWithFrame:CGRectMake(tiX, tiY, tiW, tiH)];
    [self.contentView addSubview:self.titlelabel];
    
    CGFloat imageX =5;
    CGFloat imageY =40;
    CGFloat imageW =115;
    CGFloat imageH =85;
    self.imageView1 =[[UIImageView alloc] initWithFrame:CGRectMake(imageX, imageY, imageW, imageH)];
    [self.contentView addSubview:self.imageView1];
    
    
    CGFloat image1X =125 ;
    CGFloat image1Y =40;
    CGFloat image1W =115;
    CGFloat image1H =85;
    self.imageView2 =[[UIImageView alloc] initWithFrame:CGRectMake(image1X, image1Y, image1W, image1H)];
    [self.contentView addSubview:self.imageView2];
    
    self.imageView3 =[[UIImageView alloc] initWithFrame:CGRectMake(245, 40, 115, 85)];
    [self.contentView addSubview:self.imageView3];
    self.button =[UIButton buttonWithType:UIButtonTypeCustom];
//    [_button addTarget:self action:@selector(buttonad:) forControlEvents:UIControlEventTouchUpInside];
    
    
}




-(void)setModel:(NewModel *)model{
    if (_model !=model) {
        _model =nil;
        _model =model;
        [self layoutModel];
    }
    
}

-(void)layoutModel{
    
    self.titlelabel.text =self.model.title;
    [self.imageView1  sd_setImageWithURL:[NSURL URLWithString:self.model.imgsrc]];
    NSString *str1 =[self.model.imgextra[0] objectForKey:@"imgsrc"];
    NSString *str2 =[self.model.imgextra[1]objectForKey:@"imgsrc"];
    
    [self.imageView2 sd_setImageWithURL:[NSURL URLWithString:str1]];
    [self.imageView3 sd_setImageWithURL:[NSURL URLWithString:str2]];
   
    
    
}

//-(void)layoutModel:(NewModel *)model handle:(void (^)())handle{
//      self.titlelabel.text =self.model.title;
//    NSURL *url =[NSURL URLWithString:model.imgsrc];
//    NSURL *url1 =[NSURL URLWithString:[model.imagextra[0] allValues].firstObject];
//    NSURL *url2 =[NSURL URLWithString:[model.imagextra[1] allValues].firstObject];
//    [self.imageView1 sd_setImageWithURL:url];
//    [self.imageView2 sd_setImageWithURL:url1];
//    [self.imageView3 sd_setImageWithURL:url2];



//
//}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    
    // Configure the view for the selected state
}




@end
